#ifndef _LEDTUBE_H
#define _LEDTUBE_H

#include "type.h"

#define tubePin P0		// 数码管数据脚
#define tubeSw	P2		// 数码管选择脚
#define tubeNum	4		// 数码管数量
#define tube1on	(tubeSw = 0x0E)
#define tube2on (tubeSw = 0x0D)
#define tube3on (tubeSw = 0x0B)
#define tube4on (tubeSw = 0x07)
#define tubeOff (tubeSw &= 0xF0)

// 位域操作
typedef struct{
	uint8_t d0:4;
	uint8_t d1:4;
	uint8_t d2:4;
	uint8_t d3:4;
} TubeDataBuff;
// 数码管显示数据，由于是四位，所以不会溢出，直接写数据再调用autoTubeShow函数即可
extern TubeDataBuff tubeData;

//extern code uint8_t tubeTansform[16];

void tubeShow(uint8_t sw, uint8_t num);
void autoTubeShow();
void tubeDataSet_int(uint16_t num);
void tubeDataSet_time(uint16_t time);

#endif
